package com.joshua.viewtest.demo.cardview;

import android.graphics.Point;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.view.View;

import com.joshua.viewtest.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class CardViewTest3 extends AppCompatActivity {
    private static final String TAG = "joshua";
    @BindView(R.id.cardView)
    CardView mCardView;

    @BindView(R.id.cardView2)
    CardView mCardView2;

    private int mHeight, mWidth;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_card_view_test3);
        ButterKnife.bind(this);

        Point point = new Point();
        getWindowManager().getDefaultDisplay().getSize(point);
        mHeight = point.y;
        mWidth = point.x;

        mCardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int y = (int) -v.getY();
                mCardView.animate().translationY(y).scaleX(mWidth / (1f * v.getMeasuredWidth
                        ()));
            }
        });
    }
}
